package homework;

/**
 * @ClassName HomeWork02
 * @Description TODO
 * @Author hp
 * @Date 2021/6/18 18:24
 * @Version 1.0
 **/
public class HomeWork02 {
    private String color;
    private String type;

    public HomeWork02(String color, String type) {
        this.color = color;
        this.type = type;
    }

    public HomeWork02() {
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
    public String  toString(){
        return "["+type+","+color+"]";
    }
    public boolean equals(Object obj){
        if (obj == null)
            return false;
        if (this == obj)
            return false;
        if (obj instanceof HomeWork02){
            HomeWork02 car = (HomeWork02)obj;
            return this.color.equals(car.color)&&this.type.equals(car.type);
        }
        return false;
    }
}
class test{
    public static void main(String[] args) {
        HomeWork02 car1 = new HomeWork02("极光","宝马");
        HomeWork02 car2 = new HomeWork02("极光","马");
        System.out.println("car1.equals(car2) = " + car1.equals(car2));
    }
}
